﻿using Modules.Project;
using PetaPoco;
using PmSoft;
using PmSoft.Caching;
using System.ComponentModel;

namespace Modules.BankSpecialAccount.Entitys
{
    /// <summary>
    /// 专户收支信息
    ///</summary>
    [TableName("project_special_account_payment")]
    [Description("工资专户收支信息")]
    [PrimaryKey("Id", AutoIncrement = true)]
    [CacheSetting(true)]
    [Serializable]
    public class BankSpecialAccountPayment : IEntity
    {
        /// <summary>
        ///
        ///</summary>
        [Column("id")]
        public int Id { get; set; }

        /// <summary>
        /// 流水号
        ///</summary>
        [Column("serial_number")]
        public string SerialNumber { get; set; } = string.Empty;

        /// <summary>
        /// 项目ID
        ///</summary>
        [Column("project_id")]
        public int ProjectId { get; set; }

        /// <summary>
        /// 银行流水号
        ///</summary>
        [Column("bank_serial_number")]
        public string BankSerialNumber { get; set; } = string.Empty;

        /// <summary>
        /// 收支类型(1：进账 2: 出账)
        ///</summary>
        [Column("income_type")]
        public 收支类型 IncomeType { get; set; }

        /// <summary>
        /// 交易类型（100：资金入账 102：代发工资 103：计息 104：手续费 105：其他）
        ///</summary>
        [Column("trade_type")]
        public 交易类型 TradeType { get; set; }

        /// <summary>
        /// 账户Id
        ///</summary>
        [Column("account_id")]
        public int AccountId { get; set; }

        /// <summary>
        /// 账户名称
        ///</summary>
        [Column("account_name")]
        public string AccountName { get; set; } = string.Empty;

        /// <summary>
        /// 银行账号
        ///</summary>
        [Column("bank_no")]
        public string BankNo { get; set; } = string.Empty;

        /// <summary>
        /// 对方户名
        ///</summary>
        [Column("opposite_name")]
        public string OppositeName { get; set; } = string.Empty;

        /// <summary>
        /// 对方账户
        ///</summary>
        [Column("opposite_account")]
        public string OppositeAccount { get; set; } = string.Empty;

        /// <summary>
        /// 收支金额
        ///</summary>
        [Column("amount")]
        public decimal Amount { get; set; }

        /// <summary>
        /// 收支日期
        ///</summary>
        [Column("income_date")]
        public DateTime? IncomeDate { get; set; }

        /// <summary>
        /// 余额
        ///</summary>
        [Column("balance")]
        public decimal Balance { get; set; } = 0;

        /// <summary>
        /// 收支日期
        ///</summary>
        [Column("create_time")]
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 交易币种
        /// </summary>
        [Column("trade_currency")]
        public string TradeCurrency { get; set; } = string.Empty;

        /// <summary>
        /// 交易摘要
        /// </summary>
        [Column("trad_abstract")]
        public string TradAbstract { get; set; } = string.Empty;

        /// <summary>
        /// 交易备注
        /// </summary>
        [Column("trad_remarks")]
        public string TradRemarks { get; set; } = string.Empty;

        #region IEntity 成员

        [Ignore]
        object IEntity.EntityId { get { return Id; } }

        #endregion IEntity 成员
    }
}